//
//  LWNetworkTools.swift
//  ios8-01 weibo框架搭建
//
//  Created by blue on 16/2/28.
//  Copyright © 2016年 honeywell. All rights reserved.
//

import UIKit

import AFNetworking

class LWNetworkTools: AFHTTPSessionManager {
    
    
    private static let instance: LWNetworkTools = {
        // baseURL 要以 `/` 结尾
        let urlString = "https://api.weibo.com/"
        let baseURL = NSURL(string: urlString)!
        
        let tools = LWNetworkTools(baseURL: baseURL)
        
        // 设置相应的默认反序列化格式
        tools.responseSerializer.acceptableContentTypes = NSSet(objects: "application/json", "text/json", "text/javascript", "text/plain") as! Set<String>
        
        return tools
    }()
    
    /// 全局访问方法
    class func sharedNetworkTools() -> LWNetworkTools {
        return instance
    }
}
